package io.cloud.tec.ant_design_vue_pro.web;

import io.cloud.tec.ant_design_vue_pro.dto.ArticleDTO;
import io.cloud.tec.project.util.JsonUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("api/article")
public class ArticleWeb {

    @GetMapping("list")
    List<ArticleDTO> list() {
        String article = "{id:tmpKey,avatar:avatar[num],owner:owner[num],content:content,star:Mock.mock('@integer(1, 999)'),percent:Mock.mock('@integer(1, 999)'),like:Mock.mock('@integer(1, 999)'),message:Mock.mock('@integer(1, 999)'),description:description,href:href,title:titles[i%8],updatedAt:Mock.mock('@datetime'),members:[{avatar:'https://gw.alipayobjects.com/zos/rmsportal/ZiESqWwCXBRQoaPONSJe.png',name:'曲丽丽',id:'member1'},{avatar:'https://gw.alipayobjects.com/zos/rmsportal/tBOxZPlITHqwlGjsJWaF.png',name:'王昭君',id:'member2'},{avatar:'https://gw.alipayobjects.com/zos/rmsportal/sBxjgqiuHMGRkIjqlQCd.png',name:'董娜娜',id:'member3'}],activeUser:Math.ceil(Math.random()*100000)+100000,newUser:Math.ceil(Math.random()*1000)+1000,cover:parseInt(i/4,10)%2===0?covers[i%4]:covers[3-(i%4)]}";
        return JsonUtils.parseList(article, ArticleDTO.class);
    }
}
